#include <bits/stdc++.h>
using namespace std;
using ll = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = (a); i <= (b); i++)
#define per(i, a, b) for (int i = (a); i >= (b); i--)
#define endl '\n'
const int N = 5e5 + 5;

int n, m;
ll a[N], b[N];
ll sum[N << 2], val[N << 2];

ll gcd(ll a, ll b) { return b == 0 ? a : gcd(b, a % b); }
void pushup(int p) {
  sum[p] = sum[p << 1] + sum[p << 1 | 1];
  val[p] = gcd(val[p << 1], val[p << 1 | 1]);
}
void build(int p, int l, int r) {
  if (l == r) {
    sum[p] = b[l];
    val[p] = abs(b[l]);
    return;
  }
  int mid = (l + r) >> 1;
  build(p << 1, l, mid);
  build(p << 1 | 1, mid + 1, r);
  pushup(p);
}
void update(int x, ll d, int p, int l, int r) {
  if (l == r) {
    b[l] += d;
    sum[p] = b[l];
    val[p] = abs(b[l]);
    return;
  }
  int mid = (l + r) >> 1;
  if (x <= mid)
    update(x, d, p << 1, l, mid);
  else
    update(x, d, p << 1 | 1, mid + 1, r);
  pushup(p);
}
ll query_sum(int L, int R, int p, int l, int r) {
  if (L <= l && R >= r) return sum[p];
  ll res = 0;
  int mid = (l + r) >> 1;
  if (L <= mid) res += query_sum(L, R, p << 1, l, mid);
  if (R > mid) res += query_sum(L, R, p << 1 | 1, mid + 1, r);
  return res;
}
ll query_val(int L, int R, int p, int l, int r) {
  if (L <= l && R >= r) return val[p];
  ll res = 0;
  int mid = (l + r) >> 1;
  if (L <= mid) res = gcd(res, query_val(L, R, p << 1, l, mid));
  if (R > mid) res = gcd(res, query_val(L, R, p << 1 | 1, mid + 1, r));
  return res;
}
ll query(int L, int R) {
  ll x = query_sum(1, L, 1, 1, n);
  if (L == R) return x;
  ll y = query_val(L + 1, R, 1, 1, n);
  return gcd(x, y);
}

int main() {
  ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  cin >> n >> m;
  rep(i, 1, n) cin >> a[i];
  rep(i, 1, n) b[i] = a[i] - a[i - 1];
  build(1, 1, n);
  while (m--) {
    char op;
    int L, R;
    ll d;
    cin >> op >> L >> R;
    if (op == 'C') {
      cin >> d;
      update(L, d, 1, 1, n);
      if (R + 1 <= n) update(R + 1, -d, 1, 1, n);
    } else {
      cout << query(L, R) << endl;
    }
  }
  return 0;
}